package com.bawei.mall.user.api;


import com.bawei.common.core.constant.SecurityConstants;
import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.common.core.web.page.TableDataInfo;
import com.bawei.mall.user.domain.CusUser;
import com.bawei.mall.user.domain.MallUserCollectInfo;
import com.bawei.mall.user.factory.RemoteCusUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * 用户服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteCusUserService", value = ServiceNameConstants.USER_SERVICE, fallbackFactory = RemoteCusUserFallbackFactory.class)
public interface RemoteCusUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source   请求来源
     * @return 结果
     */
    @GetMapping("/cusInfo/{username}")
    public R<CusUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取收藏信息
     */
    @GetMapping("/selectCollectInfos")
    public TableDataInfo selectCollectInfos(MallUserCollectInfo collect, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取收藏信息
     */
    @GetMapping("/getAllCollectInfos")
    public R<List<MallUserCollectInfo>> getAllCollectInfos();
}
